LM ADD SPOT LIGHT

This command adds a light that shines a cone of light in a particular direction from a specified point, like a flash light.

  Syntax
LM Add Spot Light PosX#, PosY#, PosZ#, DirX#, DirY#, DirZ#, Ang1#, Ang2#, Range#, Red#, Green#, Blue# 

  Parameters

PosX#
The X component of the light's position.

PosY#
The Y component of the light's position.

PosZ#
The Z component of the light's position.

DirX#
The X component of the light cone's direction.

DirY#
The Y component of the light cone's direction.

DirZ#
The Z component of the light cone's direction.

Ang1#
The inner angle of the light cone, which receives full light.

Ang2#
The outer angle of the light cone, where light becomes zero.

Range#
The maximum distance the light can travel from the light position.

Red#
The red component of the light's colour.

Green#
The green component of the light's colour.

Blue#
The blue component of the light's colour.

  Returns

This command does not return a value.

  Description

You can control the size of the light cone using the two values Ang1 and Ang2. Ang2 is the maximum size of the cone, in degrees, where 1 is a a very thin cone pointing straight down the specified direction, 180 is a forward half sphere and 360 is a full sphere (like a point light) and all values in between. Ang1 must be less than Ang2 and defines a smaller cone that receives full light from the spot light, the area between Ang1 and Ang2 is shaded smoothly between the spotlight colour and black. For example, if Ang1 and Ang2 are the same then there is no smooth shading and all points inside the light cone receive the full spotlight colour, and if Ang1 is 0 then only the point directly in front of the spot light receives full light while the rest is shaded to the boundary.



This shows the camera looking in the same direction as a spot light as it falls on an object. Spot lights also fade over distance in the same manner as a point light up to the light's radius (range):



The blue line represents the intensity of the light as it fades over distance, it is at its brightest at the light position and fades to zero at the light's radius. The light colour is set using the three colour values red, green and blue, and are set as floats between 0.0 for no colour to 1.0 for full colour. This is similar to the DarkBasic RGB() command where 0 is no colour and 255 is full colour. Therefore, in this case 0,0,0 is black, 1,1,1 is white, and 0.2,0,0 is dark red. The colour values can be set above 1.0 to create a light that 'washes out' nearby objects, or below 0.0 to create a shadow light that removes light from areas it affects. The final lightmap colour will be limited to 0.0-1.0